package com.hzdh.account.commom.interceptor;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Description:拦截器配置
 * @author wumingfei
 *
 */
@Configuration
public class LoginConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //注册LoginConfig拦截器
        InterceptorRegistration registration = registry.addInterceptor(new LoginInterceptor());
        registration.addPathPatterns("/**");                      //所有路径都被拦截
        registration.excludePathPatterns(                         //添加不拦截路径
        		"/login",            //登录
        		"/login/image", //登录背景图片路径
				"/author",
				"/**/*.html",            //html静态资源
				"/*.html",
				"/static/**/*.js",
				"/static/**/*.css",
				"/static/**/*.eot",
				"/static/**/*.svg",
				"/static/**/*.ttf",
				"/static/**/*.woff",
				"/static/**/*.woff2",
				"/static/**/*.gif"
        		);    
    }
}
